phase2: add ability to clone feeds via SSH
authorJo-Philipp Wich <[email protected]>
Mon, 24 Jun 2019 04:12:31 +0000 (06:12 +0200)
committerJo-Philipp Wich <[email protected]>
Mon, 24 Jun 2019 04:12:31 +0000 (06:12 +0200)
Signed-off-by: Jo-Philipp Wich <[email protected]>
phase2/config.ini.example
phase2/master.cfg

index 2b250a31ecf2c6f0ff6762d78f5206f1a940e443..2df80f88a0941361e96e31fc5a06dfd6a3e9b2b8 100644 (file)
@@ -5,6 +5,7 @@ buildbot_url = http://phase2.builds.lede-project.org/
 homedir = ../phase1
 port = 9990
 persistent = false
+git_ssh = true
 
 [status]
 bind = tcp:8011:interface=127.0.0.1
index 5a3f0058ae64dc664db10538c68e38eef48b17bc..3e9d1c7c2d9085c13dcc4128cbb135a0e00ff5fe 100644 (file)
@@ -31,6 +31,7 @@ slave_port = 9990
 persistent = False
 other_builds = 0
 tree_expire = 0
+git_ssh = False
 
 if ini.has_option("general", "port"):
        slave_port = ini.getint("general", "port")
@@ -44,6 +45,9 @@ if ini.has_option("general", "other_builds"):
 if ini.has_option("general", "expire"):
        tree_expire = ini.getint("general", "expire")
 
+if ini.has_option("general", "git_ssh"):
+       git_ssh = ini.getboolean("general", "git_ssh")
+
 c['slaves'] = []
 max_builds = dict()
 
@@ -340,13 +344,36 @@ for arch in arches:
                command = ["./ccache.sh"],
                haltOnFailure = True))
 
+       if git_ssh:
+               factory.addStep(FileDownload(
+                       name = "dlgitclonekey",
+                       mastersrc = home_dir+"/git-clone.key",
+                       slavedest = "../git-clone.key",
+                       mode = 0600))
+
+               factory.addStep(ShellCommand(
+                       name = "patchfeedsconf",
+                       description = "Patching feeds.conf",
+                       workdir = "build/sdk",
+                       command = "sed -e 's#https://#ssh://git@#g' feeds.conf.default > feeds.conf",
+                       haltOnFailure = True))
+
        factory.addStep(ShellCommand(
                name = "updatefeeds",
                description = "Updating feeds",
                workdir = "build/sdk",
                command = ["./scripts/feeds", "update", "-f"],
+               env = {'GIT_SSH_COMMAND': WithProperties("ssh -o IdentitiesOnly=yes -o IdentityFile=%(cwd)s/git-clone.key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no", cwd=GetCwd)} if git_ssh else {},
                haltOnFailure = True))
 
+       if git_ssh:
+               factory.addStep(ShellCommand(
+                       name = "rmfeedsconf",
+                       description = "Removing feeds.conf",
+                       workdir = "build/sdk",
+                       command=["rm", "feeds.conf"],
+                       haltOnFailure = True))
+
        factory.addStep(ShellCommand(
                name = "installfeeds",
                description = "Installing feeds",